package com.app.controller;

import com.app.common.Result;
import com.app.model.AnswerModel;
import com.app.model.CountModel;
import com.app.model.ProjectModel;
import com.app.model.StriveFundsModel;
import com.app.service.AttractInvestmentService;
import com.app.service.ProjectProgressService;
import com.app.service.StriveForFundsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Controller
@RestController
@RequestMapping("/api/count")
public class CountController {
    @Autowired
    private ProjectProgressService projectProgressService;
    @Autowired
    private StriveForFundsService striveForFundsService;
    @Autowired
    private AttractInvestmentService attractInvestmentService;

    @GetMapping("/selectCount")
    public Result<Object> selectCount() {
        //重点项目
        ProjectModel projectCount = projectProgressService.selectCount();
        //争取资金
        StriveFundsModel fundsCount =striveForFundsService.selectCount();
        //招商引资
        AnswerModel answerModel = attractInvestmentService.selectCount();
        CountModel countModel = new CountModel();
        countModel.setProjectBlueCount(projectCount.getBlueCount());
        countModel.setProjectYellowCount(projectCount.getYellowCount());
        countModel.setProjectRedCount(projectCount.getRedCount());

        countModel.setFundBlueCount(fundsCount.getBlueCount());
        countModel.setFundRedCount(fundsCount.getRedCount());
        countModel.setFundYellowCount(fundsCount.getYellowCount());

        countModel.setBusinessBlueCount(answerModel.getBlueCount());
        countModel.setBusinessRedCount(answerModel.getRedCount());
        countModel.setBusinessYellowCount(answerModel.getYellowCount());

        return Result.success(countModel);
    }
}
